#ifndef __SHMIPC_SHM_COND_H__
#define __SHMIPC_SHM_COND_H__

#include "shmipc/core/shm_mutex.h"

namespace shmipc::core {

enum class shm_cond_status: uint8_t {
    Ready = 0,
    Timeout,
    Error,
};

class ShmCond final {
public:
    ShmCond();
    ~ShmCond();
public:
    void wait(AutoShmMutex& lock);
    shm_cond_status wait_for(AutoShmMutex& lock, uint32_t timeout_ms);

public:
    void notify_one();
    void notify_all();
private:
    pthread_cond_t cond_;
};


} //namespace shmipc::core

#endif /** !__SHMIPC_SHM_COND_H__ */
